/**
 * 路由基础配置(模块化---值得学)
 * 1.导出布局组件
 * 2.导出主要重定向路由记录
 * 3.导出异常页面路由记录
 */

// 导入模块中的类型定义
import type { RouteRecordRaw } from 'vue-router';
import { REDIRECT_ROUTE_NAME } from '@/router/constants';

// 导出布局组件
export const DEFAULT_LAYOUT = () => import('@/layout/default-layout.vue');

// 导出主要重定向路由(RouteRecordRaw = 路由配置类型限制)
export const REDIRECT_MAIN: RouteRecordRaw = {
  path: '/redirect',
  name: 'redirectWrapper',
  component: DEFAULT_LAYOUT,
  meta: {
    requiresAuth: true,
    hideInMenu: true,
  },
  children: [
    {
      path: '/redirect/:path',
      name: REDIRECT_ROUTE_NAME,
      component: () => import('@/views/redirect/index.vue'),
      meta: {
        requiresAuth: true,
        hideInMenu: true,
      },
    },
  ],
};

// 导出异常页面路由(RouteRecordRaw = 路由配置类型限制)
export const NOT_FOUND_ROUTE: RouteRecordRaw = {
  path: '/:pathMatch(.*)*',
  name: 'notFound',
  component: () => import('@/views/not-found/index.vue'),
};
